package com.xwj.controller;

import com.xwj.service.ProducerService;
import org.apache.rocketmq.client.producer.SendResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/producer")
@RestController
public class ProducerController {
    @Autowired
    private ProducerService producerService;

    @GetMapping("/syncSendMsg")
    public SendResult syncSendMsg() {
        return producerService.syncSendMsg("syncSendMsg");
    }

    @GetMapping("/asyncSendMsg")
    public void asyncSendMsg() {
        producerService.asyncSendMsg("asyncSendMsg");
    }

    @GetMapping("/asyncSendMsg")
    public void asyncSendOrderly(String orderNo) {
        producerService.asyncSendOrderly("asyncSendOrderly", orderNo);
    }
}
